package com.cellngine.client;

import static org.lwjgl.opengl.GL11.*;

/**
 * Tile implementation
 * 
 * @author James Wood <Chryseus8086@gmail.com>
 * 
 */
public class Tile
{
	private float	scaleFactor;
	private short	texture;
	private short	gridx;
	private short	gridy;
	
	public Tile()
	{
		
	}
	
	public void setTexture(final short id)
	{
		texture = id;
	}
	
	public void setPosition(final short gridx, final short gridy)
	{
		this.gridx = gridx;
		this.gridy = gridy;
	}
	
	public void draw()
	{
		final float pixelx = gridx * 80;
		final float pixely = gridy * 80;
		glBindTexture(GL_TEXTURE_2D, texture);
		glPushMatrix();
		glTranslatef(pixelx, pixely, 0.0f);
		glBegin(GL_QUADS);
		glColor3f(1.0f, 1.0f, 1.0f);
		glTexCoord2f(0f, 0f);
		glVertex2f(0f, 0f);
		glTexCoord2f(0f, 1f);
		glVertex2f(0f, 80); // ,height
		glTexCoord2f(1f, 1f);
		glVertex2f(80, 80); // width, height
		glTexCoord2f(1f, 0f);
		glVertex2f(80, 0f); // width,
		glEnd();
		glPopMatrix();
	}
	
	public void setScaleFactor(final float scale)
	{
		this.scaleFactor = scale;
	}
	
}
